//
//  SecondViewController.swift
//  View
//
//  Created by lanou on 16/11/4.
//  Copyright (c) 2016年 lanou. All rights reserved.
//

import UIKit

class SecondViewController: UIViewController {
   
    var closure:((color:UIColor)->Void)?
    override func viewDidLoad() {
        super.viewDidLoad()
       let secondBtn = UIButton(frame: CGRectMake(100, 50, 50, 50))
        secondBtn.backgroundColor = UIColor.redColor()
        secondBtn.setTitle("priv", forState: .Normal)
        secondBtn.addTarget(self, action: "privPage", forControlEvents: .TouchUpInside)
        view.addSubview(secondBtn)
        view.backgroundColor = UIColor.grayColor()
    }

    func privPage(){
      let yellowColor = UIColor.yellowColor()
        closure!(color: yellowColor)
        navigationController?.popViewControllerAnimated(true)
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
